import axios from '~/axios.js'

//获取菜单树
function getMenuTree() {
    return axios.get('/v1/menu/tree')
}

//添加菜单
function addMenu(body) {
    return axios.post('/v1/menu/create', body)
}

//更新菜单
function updateMenu(body) {
    return axios.put('/v1/menu/edit', body)
}


//删除菜单
function deleteMenu(id) {
    return axios.delete(`/v1/menu/del?id=${id}`)
}

//根据角色获取菜单ids
function getMenuIdByRole(id){
    return axios.get(`/v1/menu/getMenuIdByRole?roleId=${id}`)
}

export default {
    getMenuTree,
    addMenu,
    updateMenu,
    deleteMenu,
    getMenuIdByRole
}